<!DOCTYPE html><html lang="en" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"><title>使用python绘制散点图 | Knowei</title><meta name="author" content="Knowei"><meta name="copyright" content="Knowei"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="1.绘制散点图以下是一些代码 1. 首先需要安装python的一些库使用pip install xxx即可安装库，但是在高版本的scikit-learn库中，已经把joblib这个函数给去除了，有两种方法来解决  安装0.22版本的scikit-learn即可（安装0.22版本需要Python3.8的版本，高版本也许无法安装）  12345import numpy as npimport pand">
<meta property="og:type" content="article">
<meta property="og:title" content="使用python绘制散点图">
<meta property="og:url" content="https://knowei.gitee.io/2023/04/01/test1/index.html">
<meta property="og:site_name" content="Knowei">
<meta property="og:description" content="1.绘制散点图以下是一些代码 1. 首先需要安装python的一些库使用pip install xxx即可安装库，但是在高版本的scikit-learn库中，已经把joblib这个函数给去除了，有两种方法来解决  安装0.22版本的scikit-learn即可（安装0.22版本需要Python3.8的版本，高版本也许无法安装）  12345import numpy as npimport pand">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="https://api.yimian.xyz/img">
<meta property="article:published_time" content="2023-03-31T16:00:00.000Z">
<meta property="article:modified_time" content="2023-04-02T07:49:24.818Z">
<meta property="article:author" content="Knowei">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://api.yimian.xyz/img"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://knowei.gitee.io/2023/04/01/test1/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: 'Copy successfully',
    error: 'Copy error',
    noSupport: 'The browser does not support'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: 'Just',
    min: 'minutes ago',
    hour: 'hours ago',
    day: 'days ago',
    month: 'months ago'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: false,
  }
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '使用python绘制散点图',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-04-02 15:49:24'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
    win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
      const link = document.createElement('link')
      link.rel = 'stylesheet'
      link.href = url
      if (id) link.id = id
      link.onerror = reject
      link.onload = link.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        link.onload = link.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(link)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><link rel="stylesheet" href="/css/mycss.css"><meta name="generator" content="Hexo 6.3.0"></head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://cdnjson.com/images/2023/02/13/avatar.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">Articles</div><div class="length-num">2</div></a><a href="/tags/"><div class="headline">Tags</div><div class="length-num">0</div></a><a href="/categories/"><div class="headline">Categories</div><div class="length-num">0</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> List</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/music/"><i class="fa-fw fas fa-music"></i><span> Music</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> Movie</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://api.yimian.xyz/img')"><nav id="nav"><span id="blog-info"><a href="/" title="Knowei"><span class="site-name">Knowei</span></a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> List</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/music/"><i class="fa-fw fas fa-music"></i><span> Music</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> Movie</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">使用python绘制散点图</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">Created</span><time class="post-meta-date-created" datetime="2023-03-31T16:00:00.000Z" title="Created 2023-04-01 00:00:00">2023-04-01</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2023-04-02T07:49:24.818Z" title="Updated 2023-04-02 15:49:24">2023-04-02</time></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="使用python绘制散点图"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">Post View:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="1-绘制散点图"><a href="#1-绘制散点图" class="headerlink" title="1.绘制散点图"></a>1.绘制散点图</h1><p>以下是一些代码</p>
<h3 id="1-首先需要安装python的一些库"><a href="#1-首先需要安装python的一些库" class="headerlink" title="1. 首先需要安装python的一些库"></a>1. 首先需要安装python的一些库</h3><p>使用<code>pip install xxx</code>即可安装库，但是在高版本的scikit-learn库中，已经把joblib这个函数给去除了，有两种方法来解决</p>
<ol>
<li>安装0.22版本的scikit-learn即可（安装0.22版本需要Python3.8的版本，高版本也许无法安装）</li>
</ol>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> numpy <span class="keyword">as</span> np</span><br><span class="line"><span class="keyword">import</span> pandas <span class="keyword">as</span> pd</span><br><span class="line"><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</span><br><span class="line"><span class="keyword">from</span> sklearn.linear_model <span class="keyword">import</span> SGDRegressor</span><br><span class="line"><span class="keyword">from</span> sklearn.externals <span class="keyword">import</span> joblib</span><br></pre></td></tr></table></figure>
<ol start="2">
<li>另外安装joblib库即可</li>
</ol>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> numpy <span class="keyword">as</span> np</span><br><span class="line"><span class="keyword">import</span> pandas <span class="keyword">as</span> pd</span><br><span class="line"><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</span><br><span class="line"><span class="keyword">from</span> sklearn.linear_model <span class="keyword">import</span> SGDRegressor</span><br><span class="line"><span class="keyword">import</span> joblib</span><br></pre></td></tr></table></figure>

<p>以上就是库的一些说明</p>
<h3 id="2-读取数据"><a href="#2-读取数据" class="headerlink" title="2.读取数据"></a>2.读取数据</h3><p>从house_data.txt读取数据</p>
<blockquote>
<p>如果在数据中，没有<code>area，price</code>这两行数据，需要自己写进去在数据顶部写入.</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">比如</span><br><span class="line">area<span class="punctuation">,</span>price</span><br><span class="line"><span class="number">98.87</span><span class="punctuation">,</span> <span class="number">599.0</span></span><br><span class="line"><span class="number">68.74</span><span class="punctuation">,</span> <span class="number">450.0</span></span><br><span class="line"><span class="number">89.24</span><span class="punctuation">,</span> <span class="number">440.0</span></span><br><span class="line"><span class="number">129.19</span><span class="punctuation">,</span> <span class="number">780.0</span></span><br><span class="line"><span class="number">61.64</span><span class="punctuation">,</span> <span class="number">450.0</span></span><br><span class="line"><span class="number">74.0</span><span class="punctuation">,</span> <span class="number">315.0</span></span><br><span class="line"><span class="number">124.07</span><span class="punctuation">,</span> <span class="number">998.0</span></span><br><span class="line"><span class="number">65.0</span><span class="punctuation">,</span> <span class="number">435.0</span></span><br><span class="line"><span class="number">57.52</span><span class="punctuation">,</span> <span class="number">435.0</span></span><br></pre></td></tr></table></figure>
</blockquote>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">df = pd.read_csv(<span class="string">&#x27;data/house_data.txt&#x27;</span>, sep=<span class="string">&#x27;,&#x27;</span>, header=<span class="number">0</span>)</span><br><span class="line">plt.scatter(df[<span class="string">&#x27;area&#x27;</span>], df[<span class="string">&#x27;price&#x27;</span>], c=<span class="string">&#x27;b&#x27;</span>)</span><br><span class="line">plt.show()</span><br></pre></td></tr></table></figure>

<h3 id="3-训练模型"><a href="#3-训练模型" class="headerlink" title="3.训练模型"></a>3.训练模型</h3><p>没什么好说的，注意<code>joblib.dump(model, &#39;save/SGDRegressor.model&#39;)</code>需要先将文件夹创建处理，不然会报错的<br>比如上面我是保存在save的文件夹的，那么需要先在程序根目录先把文件夹save创建出来</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">df = (df - df.<span class="built_in">min</span>()) / (df.<span class="built_in">max</span>() - df.<span class="built_in">min</span>())</span><br><span class="line">train_data = df.sample(frac=<span class="number">0.8</span>, replace=<span class="literal">False</span>)</span><br><span class="line">test_data = df.drop(train_data.index)</span><br><span class="line">x_train = train_data[<span class="string">&#x27;area&#x27;</span>].values.reshape(-<span class="number">1</span>, <span class="number">1</span>)</span><br><span class="line">y_train = train_data[<span class="string">&#x27;price&#x27;</span>].values</span><br><span class="line">x_test = test_data[<span class="string">&#x27;area&#x27;</span>].values.reshape(-<span class="number">1</span>, <span class="number">1</span>)</span><br><span class="line">y_test = test_data[<span class="string">&#x27;price&#x27;</span>].values</span><br><span class="line"></span><br><span class="line">model = SGDRegressor(max_iter=<span class="number">500</span>, learning_rate=<span class="string">&#x27;optimal&#x27;</span>, eta0=<span class="number">0.01</span>)</span><br><span class="line">model.fit(x_train, y_train)</span><br><span class="line">pre_score = model.score(x_train, y_train)</span><br><span class="line"><span class="built_in">print</span>(<span class="string">&#x27;score=&#x27;</span>, pre_score)</span><br><span class="line"><span class="built_in">print</span>(<span class="string">&#x27;coef=&#x27;</span>, model.coef_, <span class="string">&#x27;intercept=&#x27;</span>, model.intercept_)</span><br><span class="line">joblib.dump(model, <span class="string">&#x27;save/SGDRegressor.model&#x27;</span>)</span><br><span class="line">model = joblib.load(<span class="string">&#x27;save/SGDRegressor.model&#x27;</span>)</span><br><span class="line">y_pred = model.predict(x_test)  <span class="comment"># 得到预测值</span></span><br><span class="line"><span class="built_in">print</span>(<span class="string">&#x27;测试集准确性得分=%.5f&#x27;</span> % model.score(x_test, y_test))</span><br><span class="line">MSE = np.mean((y_test - y_pred) ** <span class="number">2</span>)</span><br><span class="line"><span class="built_in">print</span>(<span class="string">&#x27;损失MSE=&#123;:.5f&#125;&#x27;</span>.<span class="built_in">format</span>(MSE))</span><br></pre></td></tr></table></figure>

<h3 id="4-绘制散点图"><a href="#4-绘制散点图" class="headerlink" title="4.绘制散点图"></a>4.绘制散点图</h3><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">plt.rcParams[<span class="string">&#x27;font.sans-serif&#x27;</span>] = [<span class="string">&#x27;SimHei&#x27;</span>]</span><br><span class="line">plt.figure(figsize=(<span class="number">10</span>, <span class="number">4</span>))</span><br><span class="line">ax1 = plt.subplot(<span class="number">121</span>)</span><br><span class="line">plt.scatter(x_test, y_test, label=<span class="string">&#x27;测试集&#x27;</span>)</span><br><span class="line">plt.plot(x_test, y_pred, <span class="string">&#x27;r&#x27;</span>, label=<span class="string">&#x27;预测回归线&#x27;</span>)</span><br><span class="line">ax1.set_xlabel(<span class="string">&#x27;面积&#x27;</span>)</span><br><span class="line">ax1.set_ylabel(<span class="string">&#x27;价格&#x27;</span>)</span><br><span class="line">plt.legend(loc=<span class="string">&#x27;upper left&#x27;</span>)</span><br><span class="line">ax2 = plt.subplot(<span class="number">122</span>)</span><br><span class="line">x = <span class="built_in">range</span>(<span class="number">0</span>, <span class="built_in">len</span>(y_test))</span><br><span class="line">plt.plot(x, y_test, <span class="string">&#x27;g&#x27;</span>, label=<span class="string">&#x27;真实值&#x27;</span>)</span><br><span class="line">plt.plot(x, y_pred, <span class="string">&#x27;r&#x27;</span>, label=<span class="string">&#x27;预测值&#x27;</span>)</span><br><span class="line">ax2.set_xlabel(<span class="string">&#x27;样本序号&#x27;</span>)</span><br><span class="line">ax2.set_ylabel(<span class="string">&#x27;价格&#x27;</span>)</span><br><span class="line">plt.legend(loc=<span class="string">&#x27;upper right&#x27;</span>)</span><br><span class="line">plt.xlabel(<span class="string">&#x27;学号--姓名&#x27;</span>)</span><br><span class="line">plt.show()</span><br></pre></td></tr></table></figure>

<blockquote>
<p>以上就是使用Python来读取数据绘制散点图的全部过程了</p>
</blockquote>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">Author: </span><span class="post-copyright-info"><a href="https://knowei.gitee.io">Knowei</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">Link: </span><span class="post-copyright-info"><a href="https://knowei.gitee.io/2023/04/01/test1/">https://knowei.gitee.io/2023/04/01/test1/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">Copyright Notice: </span><span class="post-copyright-info">All articles in this blog are licensed under <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> unless stating additionally.</span></div></div><div class="tag_share"><div class="post-meta__tag-list"></div><div class="post_share"><div class="social-share" data-image="https://api.yimian.xyz/img" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-full"><a href="/2023/04/01/hello-world/" title="暑假实习"><img class="cover" src="https://cdnjson.com/images/2023/04/02/223520.png" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">Previous Post</div><div class="prev_info">暑假实习</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://cdnjson.com/images/2023/02/13/avatar.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Knowei</div><div class="author-info__description"></div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">Articles</div><div class="length-num">2</div></a><a href="/tags/"><div class="headline">Tags</div><div class="length-num">0</div></a><a href="/categories/"><div class="headline">Categories</div><div class="length-num">0</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/xxxxxx"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/K-No-Wei" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="/2994172661@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>Announcement</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>Catalog</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#1-%E7%BB%98%E5%88%B6%E6%95%A3%E7%82%B9%E5%9B%BE"><span class="toc-number">1.</span> <span class="toc-text">1.绘制散点图</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-%E9%A6%96%E5%85%88%E9%9C%80%E8%A6%81%E5%AE%89%E8%A3%85python%E7%9A%84%E4%B8%80%E4%BA%9B%E5%BA%93"><span class="toc-number">1.0.1.</span> <span class="toc-text">1. 首先需要安装python的一些库</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-%E8%AF%BB%E5%8F%96%E6%95%B0%E6%8D%AE"><span class="toc-number">1.0.2.</span> <span class="toc-text">2.读取数据</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-%E8%AE%AD%E7%BB%83%E6%A8%A1%E5%9E%8B"><span class="toc-number">1.0.3.</span> <span class="toc-text">3.训练模型</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-%E7%BB%98%E5%88%B6%E6%95%A3%E7%82%B9%E5%9B%BE"><span class="toc-number">1.0.4.</span> <span class="toc-text">4.绘制散点图</span></a></li></ol></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>Recent Post</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2023/04/01/hello-world/" title="暑假实习"><img src="https://cdnjson.com/images/2023/04/02/223520.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="暑假实习"/></a><div class="content"><a class="title" href="/2023/04/01/hello-world/" title="暑假实习">暑假实习</a><time datetime="2023-03-31T16:00:00.000Z" title="Created 2023-04-01 00:00:00">2023-04-01</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/04/01/test1/" title="使用python绘制散点图"><img src="https://api.yimian.xyz/img" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="使用python绘制散点图"/></a><div class="content"><a class="title" href="/2023/04/01/test1/" title="使用python绘制散点图">使用python绘制散点图</a><time datetime="2023-03-31T16:00:00.000Z" title="Created 2023-04-01 00:00:00">2023-04-01</time></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('https://api.yimian.xyz/img')"><div id="footer-wrap"><div class="copyright">&copy;2022 - 2023 By Knowei</div><div class="framework-info"><span>Framework </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>Theme </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="Read Mode"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="Switch Between Light And Dark Mode"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="Toggle between single-column and double-column"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="Setting"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="Table Of Contents"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="Back To Top"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.min.js"></script><div class="js-pjax"></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>